#pragma once
#include"RBTRee.h"



namespace gm{

	template<class K>
	class MySet
	{
		struct setKeyOfT {
			const K& operator()(const K& key)
			{
				return key;
			}
		};

	public:
		typedef typename RBTree<K, const K, setKeyOfT>::iterator iterator;
		typedef typename RBTree<K, const K, setKeyOfT>::const_iterator const_iterator;


		iterator begin()
		{
			return _t.begin();
		}

		iterator end()
		{
			return _t.end();
		}

		pair<iterator,bool> insert(const K& key)
		{
			return _t.Insert(key);
		}


	private:
		RBTree<K,const K,setKeyOfT>  _t;
	};

	void test_set1()
	{
		MySet<int> s;
		int a[] = { 4, 2, 6, 1, 3, 5, 15, 7, 16, 14 };
		for (auto e : a)
		{
			s.insert(e);
		}

		MySet<int>::iterator it = s.begin();
		while (it != s.end())
		{
			//it->first += 100;
			//it->second += 100;

			cout << *it<< ":" << *it << endl;
			++it;
		}
		cout << endl;
	}
}